<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c"   uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn"  uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/test.css" type="text/css" media="all" />
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/jquery/1.4.2/jquery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/init.js"></script>
<script type="text/javascript">  
	$(document).ready(function() {
		$.ajax({
			   type: "GET",
			   url:  "/rest/glossary/types/${param.id}",
			   data: "name=" + $("#glossaryTypeName").val(),
			   success: function(data){
				   $("#glossaryTypeId").html(data.glossaryType.id);
				   $("#glossaryTypeName").val(data.glossaryType.name);
			   }
		 }); 	

		$("#saveButton").live("click", function(){
			$.ajax({
				   type: "PUT",
				   url:  "/rest/glossary/types/${param.id}",
				   data: "name=" + $("#glossaryTypeName").val(),
				   success: function(msg){
				     alert( "Data Saved: " + msg );
				     location.replace("${pageContext.request.contextPath}/glossary/type/read.do?id=${param.id}"); 
				   }
			 });
		});
	});  
</script>
</head>
<body> 
<div id="list">
	<table name="list"> 
		<tr>
			<th>글로서리타입ID</th>
			<td><span id="glossaryTypeId"></span></td>
		</tr> 
		<tr>
			<th>글로서리타입명</th>
			<td><input id="glossaryTypeName"/></td>
		</tr> 
	</table>		
	<br/>	
	<a href="#" id="saveButton" class="button">save</a> /
	<a href="${pageContext.request.contextPath}/glossary/type/list.do" id="listButton" class="button">list</a>
</div>
</body>
</html>